set x=src
set y=eventspy

rem *** Copy to a temp directory, flags:
rem *** /i: Assumes that a new destination must be a directory.
rem *** /e: Copies directories and subdirectories, including empty ones.
xcopy %x% build /i /e

rem *** Delete old xpi, flags:
rem *** /f: Force the deletion of read-only files.
del build\*.xpi /f

rem *** Create new xpi.
cd build
7z a -tzip "%y%.xpi" * -r -mx=9
cd ..

rem *** Move new xpi out of temp directory.
move build\%y%.xpi %y%.xpi

rem *** Remove temp directory, flags:
rem *** /s: Delete files and subdirectories.
rem *** /q: Quiet, don't prompt on delete.
rmdir /s /q build